﻿namespace HRM.CORE.CLASS
{
    using Dictionary.ERP;
    using Extra.ERP;
    using HRM.CORE;
    using System; using Extra.ERP;

    public class Organization
    {
        public static string GetFullOrganization(string SymbolPlace)
        {
            HRM_BRANCH hrm_branch;
            HRM_DEPARTMENT hrm_department;
            SYS_USER sys_user = new SYS_USER();
            sys_user.GetUserName(MyLogin.Account);
            string str = "";
            if (sys_user.Management == 0)
            {
                return "Tất Cả";
            }
            if (sys_user.Management == 1)
            {
                hrm_branch = new HRM_BRANCH();
                hrm_branch.Get(sys_user.BranchCode);
                return hrm_branch.BranchName;
            }
            if (sys_user.Management == 2)
            {
                hrm_branch = new HRM_BRANCH();
                hrm_branch.Get(sys_user.BranchCode);
                hrm_department = new HRM_DEPARTMENT();
                hrm_department.Get(sys_user.DepartmentCode);
                return (hrm_branch.BranchName + SymbolPlace + hrm_department.DepartmentName);
            }
            if (sys_user.Management == 3)
            {
                hrm_branch = new HRM_BRANCH();
                hrm_branch.Get(sys_user.BranchCode);
                hrm_department = new HRM_DEPARTMENT();
                hrm_department.Get(sys_user.DepartmentCode);
                HRM_GROUP hrm_group = new HRM_GROUP();
                hrm_group.Get(sys_user.GroupCode);
                str = hrm_branch.BranchName + SymbolPlace + hrm_department.DepartmentName + SymbolPlace + hrm_group.GroupName;
            }
            return str;
        }
    }
}

